package com.ouc.eddyAlgorithm.controller;

import com.ouc.common.core.domain.AjaxResult;
import com.ouc.eddyAlgorithm.service.TmEddyService;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ucar.ma2.InvalidRangeException;

import java.io.IOException;

@CrossOrigin
@RestController
@RequestMapping("/tmEddy")
public class TmEddyController {
  @Autowired
  private TmEddyService tmEddyService;

  @GetMapping("/getTmEddy")
  public AjaxResult getTmEddy(String ncFileName, Integer level, Float startLat, Float startLon, Float endLat, Float endLon, Float target) throws InvalidRangeException, IOException {

    val i = tmEddyService.tmEddyCenter(ncFileName, level, startLat, startLon, endLat, endLon, target);
    return AjaxResult.success(i);
  }

}
